package example.service;

import example.dao.UserDao;
import example.entity.User;

import java.util.List;

/**
 * @author 张心怡
 * @date 2024/12/16
 */
public class UserService {

    public static User login(String username, String password, int type) {
        return UserDao.login(username, password, type);
    }

    public static void signUp(User user) {
        UserDao.signUp(user);
    }

    public static User getUserByUsername(String username) {
        return UserDao.getUserByUsername(username);
    }

    public static User getUserByUsernameAndEmail(String username, String email) {
        return UserDao.getUserByUsernameAndEmail(username, email);
    }

    public static void updatePassWord(User user) {
        UserDao.updatePassWord(user);
    }

    public static int getTotalUsers() {
        return UserDao.getTotalUsers();
    }

    public static List<User> getAllUsers(String name) {
        return UserDao.getAllUsers(name);
    }

    public static void delete(int id) {
        UserDao.delete(id);
    }

    public static void addUser(User user) {
        UserDao.addUser(user);
    }

    public static void updateUser(User user) {
        UserDao.updateUser(user);
    }

    public static User getById(int id) {
        return UserDao.getById(id);
    }
}
